import 'package:enterprise_v6_app/app/components/special_operation/custom_gas_count_down_page.dart';
import 'package:enterprise_v6_app/app/components/special_operation/custom_safety_measure_page.dart';
import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/modules/application/special_operation/special_list/job_ticket/common/common_process/common_security_measures/common_security_measures_controller.dart';

/// 作业通用-安全措施
/// 安全措施样式模板
/// 选择类型安全措施：现场夜间有充足照明：-< A.36 V.24 V.12 X防水型灯 >- (-~)   -< B.36V、24 V、12 V防爆型灯 >- (-~)
/// 输入类型安全措施：现场配备灭火器(-^+^)台，灭火毯(-^+^)块，消防蒸汽带或消防水带(-^+^)根。
class CommonSecurityMeasuresPage extends StatelessWidget {
  CommonSecurityMeasuresPage({required this.isChange, super.key, this.isEnabled = false});

  //节点是否可编辑
  final bool isEnabled;

  // 是否在交接班中
  final bool isChange;

  final controller = Get.put(CommonSecurityMeasuresController());

  @override
  Widget build(BuildContext context) {
    return GetBuilder(
        init: controller,
        builder: (_) {
          return Column(
            children: [
              Visibility(
                visible: controller.milliseconds != 0,
                child: CustomGasCountDownPage(milliseconds: controller.milliseconds),
              ),
              Expanded(
                  child: Container(
                padding: EdgeInsets.symmetric(horizontal: 14.w, vertical: 12.w),
                margin: EdgeInsets.only(bottom: 60.w),
                color: const Color(0xFFF5F5F6),
                alignment: Alignment.topCenter,
                child: ListView.separated(
                  itemCount: controller.safetyMeasuresList.length,
                  itemBuilder: (context, index) {
                    return CustomSafetyMeasurePage(
                      isEnabled: isEnabled,
                      index: index,
                      safetyMeasures: controller.safetyMeasuresList[index],
                      isChange: isChange,
                    );
                  },
                  separatorBuilder: (BuildContext context, int index) {
                    return AppGaps.vGap20;
                  },
                ),
              ))
            ],
          );
        });
  }
}
